package com.cbnu.SmartCampusLife;

import java.util.ArrayList;

import android.annotation.SuppressLint;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

@SuppressLint("ShowToast")
public class TISMenu extends ListActivity{
	/** Called when the activity is first created. */
    
	WebView webview;
	
	private ArrayList<String> list;
	private ArrayAdapter<String> adapter;
	private String[][] tisMenuList = {
			{"졸업예비사정표", "http://gaesin.chungbuk.ac.kr/jsp/Grad/Information.jsp"},
			{"개인신상관리", "http://gaesin.chungbuk.ac.kr/jsp/Haksa/StdInformation.jsp"},
			{"납입고지서", "http://gaesin.chungbuk.ac.kr/jsp/Dung/jae_print_sum.jsp"},
			{"장학내역확인", "http://gaesin.chungbuk.ac.kr/jsp/Jang/JangList.jsp"},
			{"성적조회", "http://gaesin.chungbuk.ac.kr/jsp/Sngj/StdSngjView.jsp"},
			{"무선인터넷 신청/조회", "http://gaesin.chungbuk.ac.kr/jsp/Network/WiFi/wifi_network_info.jsp"} };
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tis_menu);
        
        list = new ArrayList<String>();
        
        for(int i = 0; i < tisMenuList.length; i++) {
        		list.add(tisMenuList[i][0]);
        }

        adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);
        setListAdapter(adapter);
	}
	
	@Override
    protected void onListItemClick (ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
        
        for(int i = 0; i < tisMenuList.length; i++) {
        	if(list.get(position).equals(tisMenuList[i][0])) {
        		Intent intent = new Intent(this, TISView.class);
        		intent.putExtra("menuName", tisMenuList[i][0]);
        		intent.putExtra("menuURL", tisMenuList[i][1]);
        		startActivity(intent);
        		break;
        	}
        }
    }
}